'use strict';
exports.main = async (event, context) => {
	//event为客户端上传的参数
	console.log('event : ', event)

	// 生成书架ID
	let sign_id = (new Date().getTime().toString().slice(-4)) + "_" + (Math.random().toString().slice(2));
	// 创建的时间戳
	let sign_create_time = new Date().getTime();
	// 解构赋值
	let {
		user_nickName,
	} = event;


	// 链接云数据库
	const db = uniCloud.database();
	const sign = db.collection('db_sign')

	// 添加
	return await sign.add({
		sign_id,
		sign_create_time,
		user_nickName
	})
	.then(content => {
		return content;
		console.log('add =>',content);
	})
	//返回数据给客户端
};